---
title: "Reference: Mastra.getServer() | Core"
description: "Documentation for the `Mastra.getServer()` method in Mastra, which retrieves the configured server configuration."
---

# Mastra.getServer()

The `.getServer()` method is used to retrieve the server configuration that has been configured in the Mastra instance.

## Usage example

```typescript copy
mastra.getServer();
```

## Parameters

This method does not accept any parameters.

## Returns

<PropertiesTable
  content={[
    {
      name: "server",
      type: "ServerConfig | undefined",
      description:
        "The configured server configuration including port, timeout, API routes, middleware, CORS settings, and build options, or undefined if no server has been configured.",
    },
  ]}
/>

## Related

- [Server deployment](/docs/v1/deployment/building-mastra)
- [Server configuration](/docs/v1/server-db/custom-api-routes)
